/*
 * Created by: Mark Lavrynenko
 * Email:	MarkLavrinenko@gmail.com
 * Project:	  Huffman
*/

#include "CodingTable.h"
#include "BitSequence.h"
#ifdef _DEBUG
#include<iostream>
#endif

CodingTable::CodingTable()
{
	storage.assign(256, nullptr);
}

const BitSequence* CodingTable::getCode(const uint8_t &byte) const
{
	return storage[byte];		
}

void CodingTable::add(const vector<char> &bits, uint8_t byte)
{
#ifdef _DEBUG
	std::cout << "Edded code for byte " << byte << std::endl;
#endif
	storage[byte] = new BitSequence(bits);
}